package com.example.hello;

import com.example.hello.client.AlertBlock.BootstrapAlertBlockState;
import com.vaadin.ui.AbstractComponent;

public class BootstrapAlertBlock extends AbstractComponent {

    public BootstrapAlertBlock() {
        this("");
    }

    public BootstrapAlertBlock(String text) {
        this(text, BootstrapAlert.AlertType.DEFAULT);
    }

    public BootstrapAlertBlock(String text, BootstrapAlert.AlertType type) {
        setHeading(text);
        setType(type);
    }

    @Override
    protected BootstrapAlertBlockState getState() {
        return (BootstrapAlertBlockState) super.getState();
    }

    public boolean isAnimation() {
        return getState().isAnimation();
    }

    public void setAnimation(boolean animated) {
        getState().setAnimation(animated);
    }

    public boolean isClose() {
        return getState().isClose();
    }

    public void setClose(boolean hasClose) {
        getState().setClose(hasClose);
    }

    public String getHeading() {
        return getState().getHeading();
    }

    public void setHeading(String heading) {
        getState().setHeading(heading);
    }

    public String getText() {
        return getState().getText();
    }

    public void setText(String text) {
        getState().setText(text);
    }

    public BootstrapAlert.AlertType getType() {
        return BootstrapAlert.AlertType.valueOf(getState().getType());
    }

    public void setType(BootstrapAlert.AlertType type) {
        getState().setType(type.toString());
    }

}